package com.tian.core.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Action entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "action", catalog = "portalservermond")
public class Action implements java.io.Serializable {

	// Fields

	private Integer id;
	private Actioncolumn actioncolumn;
	private String actionname;
	private String action;
	private String viewmode;
	private Set<Actiongroup> actiongroups = new HashSet<Actiongroup>(0);

	// Constructors

	/** default constructor */
	public Action() {
	}

	/** minimal constructor */
	public Action(Actioncolumn actioncolumn, String actionname, String action,
			String viewmode) {
		this.actioncolumn = actioncolumn;
		this.actionname = actionname;
		this.action = action;
		this.viewmode = viewmode;
	}

	/** full constructor */
	public Action(Actioncolumn actioncolumn, String actionname, String action,
			String viewmode, Set<Actiongroup> actiongroups) {
		this.actioncolumn = actioncolumn;
		this.actionname = actionname;
		this.action = action;
		this.viewmode = viewmode;
		this.actiongroups = actiongroups;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "actioncolumnid", nullable = false)
	public Actioncolumn getActioncolumn() {
		return this.actioncolumn;
	}

	public void setActioncolumn(Actioncolumn actioncolumn) {
		this.actioncolumn = actioncolumn;
	}

	@Column(name = "actionname", nullable = false, length = 100)
	public String getActionname() {
		return this.actionname;
	}

	public void setActionname(String actionname) {
		this.actionname = actionname;
	}

	@Column(name = "action", nullable = false, length = 100)
	public String getAction() {
		return this.action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	@Column(name = "viewmode", nullable = false, length = 10)
	public String getViewmode() {
		return this.viewmode;
	}

	public void setViewmode(String viewmode) {
		this.viewmode = viewmode;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "action")
	public Set<Actiongroup> getActiongroups() {
		return this.actiongroups;
	}

	public void setActiongroups(Set<Actiongroup> actiongroups) {
		this.actiongroups = actiongroups;
	}

}